Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing Extensions and Drivers /
Chapter 6 - Printing Resources / Printing Resources Reference
Resources Used Only in Printer Drivers


The PostScript Scanning ('scan') Resource

The PostScript scanning ('scan') resource, of type gxPostscriptScanningType, is used with PostScript drivers to specify a set of replacement strings that are used when interpreting the status information returned by a PostScript printer. This resource is optional.

Figure 6-27 shows the structure of a PostScript scanning resource.

Figure 6-27 The PostScript scanning resource

The PostScript scanning resource consists of an owner count field and an array of
string specifications.

Each string specification contains four strings. These strings together form the specification of how to replace strings in the status information that is returned
by the printer.

You define the source string and replacement strings as StringScan specifications, which have five variations, as shown in Table 6-34.
Table 6-34 Scan string specifications for the PostScript scanning resource
String typeValueExplanationParameters
SimpleScan0The parameter defines the string to usesA wide string
UserNameScan1Uses the name of the user as the stringNone
DocumentNameScan2Uses the name of the document as the stringNone
PrinterNameScan3Uses the name of the printer as the stringNone
NilPtrScan4Uses the empty stringNone

You define the offset with an OffsetScan specification, which has six variations, as shown in Table 6-35. None of these requires the use of parameters.
Table 6-35 Scan offset specifications for the PostScript scanning resource
Offset typeValueExplanation
SimpleOffset0No offset used-start at the beginning of the buffer
SameAsPreviousOffset1Used to insert text immediately before a source string
ReturnedOffset2Used to insert text immediately after a source string
SimpleRepeat16Same as SimpleOffset and the replacement repeats for all occurences of the source string
SampleAsPreviousRepeat17Same as SameAsPreviousOffset and repeats for all occurrences of the source string
ReturnedRepeat18Same as ReturnedOffset and repeats for all occurrences of the source string

You define the action with an ActionScan specification, which has two variations, as shown in Table 6-36.
Table 6-36 Scan-action specifications for the PostScript scanning resource
Action typeValueExplanationParameters
NoAction0No action takenNone
SimpleAction1If an error occurs, a printing alert box is displayedTwo integers

The first defines the type of error to generate (normal, nonFatalError, or fatalError)

The other specifies the resource ID of the printing alert to use

Listing 6-25 shows the PostScript scanning resources from the Apple LaserWriter IIg printer driver.

Listing 6-25 An example of PostScript scanning resources for a printer driver

resource gxPostscriptScanningType (gxPostscriptScanningID,
                                             sysHeap, purgeable)
{
   0,
   {
   SimpleScan {"busy"}, SimpleScan { "printer busy" },
      SimpleOffset {}, NoAction {};
   SimpleScan {"waiting"}, SimpleScan {"preparing data"},
      SimpleOffset {}, NoAction {};
   SimpleScan {"job:"}, SimpleScan {"User"},
      SimpleOffset {}, NoAction {};
   }
};
resource gxPostscriptScanningType (gxPostscriptScanningID + 1,
                                             sysHeap, purgeable)
{
   0,
   {
   SimpleScan {"%%["}, SimpleScan {""},
      SimpleOffset {}, NoAction {};
   SimpleScan {"]%%"}, SimpleScan {""},
      SimpleOffset {}, NoAction {};
   SimpleScan {"PrinterError"}, SimpleScan {"Printer"},
      SimpleOffset {}, NoAction {};
   };
};

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help